﻿using System;
using System.Web.Mvc;
using StructureMap;

namespace Coleotrack.Web
{
    public class StructureMapControllerFactory : DefaultControllerFactory
    {
        protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType)
        {
            try
            {
                return ObjectFactory.GetInstance(controllerType) as Controller;
            }
            catch (Exception ex)
            {
                return base.GetControllerInstance(requestContext, controllerType);
            }
        }
    }
}